--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit c4bf97dae2a7cace7af865f6444931c5080d6859
Parents : 3591034
Author : Mark Qvist <mark@unsigned.io>
Date : 2025-12-28T23:41:08+01:00
Fixed cleanup race condition on browser page close
Changes
Diff
diff --git a/nomadnet/ui/textui/Browser.py b/nomadnet/ui/textui/Browser.py
index ef37b61..ab9f069 100644
--- a/nomadnet/ui/textui/Browser.py
+++ b/nomadnet/ui/textui/Browser.py
@@ -37,19 +37,20 @@ class BrowserFrame(urwid.Frame):
if hasattr(self.delegate, "page_pile") and self.delegate.page_pile:
def df(loop, user_data):
st = None
- nf = self.delegate.page_pile.focus
- if hasattr(nf, "key_timeout"):
- st = nf
- elif hasattr(nf, "original_widget"):
- no = nf.original_widget
- if hasattr(no, "original_widget"):
- st = no.original_widget
- else:
- if hasattr(no, "key_timeout"):
- st = no
-
- if st and hasattr(st, "key_timeout") and hasattr(st, "keypress") and callable(st.keypress):
- st.keypress(None, None)
+ if self.delegate.page_pile:
+ nf = self.delegate.page_pile.focus
+ if hasattr(nf, "key_timeout"):
+ st = nf
+ elif hasattr(nf, "original_widget"):
+ no = nf.original_widget
+ if hasattr(no, "original_widget"):
+ st = no.original_widget
+ else:
+ if hasattr(no, "key_timeout"):
+ st = no
+
+ if st and hasattr(st, "key_timeout") and hasattr(st, "keypress") and callable(st.keypress):
+ st.keypress(None, None)
nomadnet.NomadNetworkApp.get_shared_instance().ui.loop.set_alarm_in(0.25, df)
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────